function baicai(){
    (function(){
        let uu =document.querySelector("#nav ul")
        
        fetch("http://chst.vip:1234/api/getbaicaijiatitle")
        .then(body => body.json())
        .then(res => {
                let html = ""
                console.log(res);
                res.result.forEach(item => {
                    html += `
                        <li titleId="${item.titleId}">${item.title}</li>
                        `
                })
                uu.innerHTML = html

                
        })

        // let ss =document.querySelector("#sec ul")

       $("#nav ul").on('click',function(e){
           let num = $(e.target).attr('titleId')
            fetch(`http://chst.vip:1234/api/getbaicaijiaproduct?titleid=${num}`)
            .then(body => body.json())
            .then(res => {
                // console.log(res);
                let html1 = ""
                res.result.forEach(item => {
                    html1 += `
                            <li>
                                <div class="dv1">${item.productImg}</div>
                                <div class="dv2">
                                    <h3>${item.productName}</h3>
                                    <i>${item.productPrice}</i>
                                    <p>${item.productCouponRemain}</p>
                                    <span>${item.productCoupon} ${item.productHref}</span>
                                </div>
                            </li>
                        `
                })

                $('#sec ul').html(html1)
            })
           

       })

       fetch(`http://chst.vip:1234/api/getbaicaijiaproduct?titleid=0`)
            .then(body => body.json())
            .then(res => {
                // console.log(res);
                let html1 = ""
                res.result.forEach(item => {
                    html1 += `
                            <li>
                                <div class="dv1">${item.productImg}</div>
                                <div class="dv2">
                                    <h3>${item.productName}</h3>
                                    <i>${item.productPrice}</i>
                                    <p>${item.productCouponRemain}</p>
                                    <span>${item.productCoupon} ${item.productHref}</span>
                                </div>
                            </li>
                        `
                })

                $('#sec ul').html(html1)
            })


        
    })()

}